package com.findweb.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.findweb.jpa.entity.City;
import com.findweb.jpa.repository.CityRepository;



//@RestController
public class JPAController {
	
	@Autowired
	private CityRepository repository;
	
	@RequestMapping("/city")
	public List<City> test() {
		List<City> result = new ArrayList<>();
		Iterable<City> all = repository.findAll();
		for(City one: all){
			result.add(one);
		}
        return result;
    }

}
